package com.crm.service.impl.customerManager;

import com.crm.dao.mapper.customMapper.customerManagerCustomMapper.CustomerRawDataCustomMapper;
import com.crm.dao.mapper.customerManager.CustomerRawDataMapper;
import com.crm.model.entity.customerManager.CustomerRawData;
import com.crm.model.entity.customerManager.CustomerRawDataExample;
import com.crm.model.qo.customerManager.CustomerRawDataQO;
import com.crm.model.vo.customerManager.CustomerRawDataVO;
import com.crm.service.customerManager.CustomerRawDataDbService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ Author ：pym
 * @ Date   ：2021/7/12 9:03
 */
@Service
public class CustomerRawDataDbServiceImpl implements CustomerRawDataDbService {
    @Autowired
    private CustomerRawDataMapper customerRawDataMapper;

    @Autowired
    private CustomerRawDataCustomMapper customerRawDataCustomMapper;

    /**
     * 根据统一社会信用代码查询所有人
     * @Author pym
     * @Date  2021/7/12 10:41
     * @param unifiedSocialCreditCode 统一社会信用代码
     * @return {@link {java.util.List<com.crm.model.entity.customerManager.CustomerRawData>}}
     */
    @Override
    public List<CustomerRawData> selectCustomerOwnerByUnifiedSocialCreditCode(String unifiedSocialCreditCode) {
        /*CustomerRawDataExample customerRawDataExample = new CustomerRawDataExample();
        CustomerRawDataExample.Criteria criteria = customerRawDataExample.createCriteria();
        criteria.andUnifiedSocialCreditCodeEqualTo(unifiedSocialCreditCode);
        return customerRawDataMapper.selectByExampleWithBLOBs(customerRawDataExample);*/
        return customerRawDataCustomMapper.selectCustomerRawDataByUnifiedSocialCreditCode(unifiedSocialCreditCode);
    }

    /**
     * 新增客户原始数据
     * @Author pym
     * @Date  2021/7/13 14:22
     * @param customerRawData 客户原始数据
     * @return {@link {java.lang.Boolean}}
     */
    @Override
    public Boolean insertCustomerRawData(CustomerRawData customerRawData) {
        Boolean result = false;
        int num = customerRawDataMapper.insertSelective(customerRawData);
        if (num > 0) {
            result = true;
        }
        return result;
    }

    /**
     * 客户原始数据
     * @Author pym
     * @Date  2021/7/20 11:03
     * @param customerRawDataQO -查询条件
     * @return {@link {java.util.List<com.crm.model.vo.customerManager.CustomerRawDataVO>}}
     */
    @Override
    public List<CustomerRawDataVO> selectCustomerRawDataList(CustomerRawDataQO customerRawDataQO) {
        return customerRawDataCustomMapper.selectCustomerRawDataList(customerRawDataQO);
    }
}
